#include <iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	while(n--){
		string a,b;
		cin>>a;
		cin>>b;
		int num=0;
		int pos=b.find(a);
		while(pos!=-1){
			num++;
			pos=b.find(a,pos+1);
		}
		cout<<num<<endl;
	}
} 
